<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="newtemplatesfiles5/img/favicon.html">

    <title>行驶证审批</title>

    <!-- Bootstrap core CSS -->
    <link href="newtemplatesfiles5/css/bootstrap.min.css" rel="stylesheet">
    <link href="newtemplatesfiles5/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="newtemplatesfiles5/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="newtemplatesfiles5/css/style.css" rel="stylesheet">
    <link href="newtemplatesfiles5/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
    <script src="newtemplatesfiles5/js/html5shiv.js"></script>
    <script src="newtemplatesfiles5/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>

<section id="container" class="">
    <!--header start-->
    <div th:insert="common/schoolCounsellor-common-header::top"></div>
    <!--header end-->
    <!--sidebar start-->
    <div th:insert="common/schoolCounsellor-common-sidebar::#left"></div>
    <!--sidebar end-->
    <!--main content start-->
    <section id="main-content">
        <section class="wrapper">
            <!-- page start-->
            <div class="row">
                <!--schoolCounsellor-stuEibck-left  start-->
                <div th:insert="common/schoolCounsellor-stuEibck-left::#schoolCounsellor-stuEbick-left"></div>
                <!--schoolCounsellor-stuEibck-left  end-->
                <aside class="profile-info col-lg-9">
                    <!--widget start-->
                    <section class="panel">
                        <div class="twt-feed blue-bg">
                            <h1>驳回理由</h1>
                        </div>
                        <section id="toWriteReason" class="panel">
                            <header class="panel-heading">
                                请填写原因
                            </header>
                            <div class="panel-body">
                                <form class="form-horizontal" role="form" id="myForm">
                                    <div class="form-group">
                                        <label class="col-lg-2 control-label">证件号</label>
                                        <div class="col-lg-10">
                                            <input id="drivingLicenseID" name="drivingLicenseID" type="text" class="form-control"
                                                    th:value="${session.drivingLicenseID eq null ? '':session.drivingLicenseID}" disabled>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 control-label">驳回原因</label>
                                        <div class="col-lg-10">
                                            <input name="rejectReason" id="reason" type="text" class="form-control"  placeholder="" >
                                            <a  id="a-reason"  th:text="请填写原因" style="color: red;visibility: hidden"></a>
                                        </div>
                                    </div>
                                </form>
                                <div class="form-group">
                                    <div class="col-lg-offset-2 col-lg-10">

                                        <button type="submit" class="btn btn-danger" onclick="correctReject()">确认驳回</button>
                                        <button type="submit" class="btn btn-info" >取消操作</button>
                                    </div>
                                </div>
                            </div>
                        </section>
                    </section>
                    <!--widget end-->

                </aside>
            </div>
            <!-- page end-->
        </section>
    </section>
    <!--main content end-->

</section>
<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="asserts/js/popper.min.js"></script>
<script src="asserts/js/feather.min.js"></script>
<script src="asserts/js/bootstrap.min.js"></script>

<!-- js placed at the end of the document so the pages load faster -->
<script src="newtemplatesfiles5/js/jquery.js"></script>
<script src="newtemplatesfiles5/js/bootstrap.min.js"></script>
<script src="newtemplatesfiles5/js/jquery.scrollTo.min.js"></script>
<script src="newtemplatesfiles5/js/jquery.nicescroll.js" type="text/javascript"></script>
<script src="newtemplatesfiles5/assets/jquery-knob/js/jquery.knob.js"></script>

<!--common script for all pages-->
<script src="newtemplatesfiles5/js/common-scripts.js"></script>

<script>

    window.onload=function(){
        $("#li1").addClass('active');
        $("#li2").removeClass('active');
        $("#li3").removeClass('active');
    };
    //knob
    $(".knob").knob();

    function correctReject() {

        var reason = document.getElementById("reason").value;
        console.log(reason.length);
        if(reason.length<1){
            console.log("请填写驳回原因");
            document.getElementById("a-reason").style.visibility="visible";
        }else{
            document.getElementById("a-reason").style.visibility="hidden";
        }
        console.log("reason");
        console.log(reason);

        alert("确定驳回吗？");
        var form = new FormData(document.getElementById("myForm"));
        console.log(form);
        form.append("drivingLicenseID",document.getElementById("drivingLicenseID").value);
        $.ajax({
            url:"rejectDrivingLicenseApplication.do",
            type:"post",
            dataType:"html",
            data:form,
            cache:false,
            processData:false,
            contentType:false,
            success: function (data) {
                console.log("success");
                alert("操作成功！");
                location.href="getApplicationOfDrivingLicense.do";
            },
            error:function (data) {
                alert("提交失败");
                console.log("error");
                location.href="404";
            }
        })

    }

</script>


</body>
</html>
